home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / bfd / oasys.c < prev    next >
C/C++ Source or Header  |  1992-09-11  |  34KB  |  1,309 lines

  1. /* bfd backend for oasys objects.
  2.    Copyright (C) 1990-1991 Free Software Foundation, Inc.
  3.    Written by Steve Chamberlain of Cygnus Support <steve@cygnus.com>.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /* $Id: oasys.c,v 1.38 1991/10/11 10:11:30 gnu Exp $ */
  22.  
  23. #define UNDERSCORE_HACK 1
  24. #include "bfd.h"
  25. #include "sysdep.h"
  26. #include "libbfd.h"
  27. #include "oasys.h"
  28. #include "liboasys.h"
  29.  
  30. /* XXX - FIXME.  offsetof belongs in the system-specific files in
  31.    ../include/sys. */
  32. /* Define offsetof for those systems which lack it */
  33.  
  34. #ifndef offsetof
  35. #define offsetof(type, identifier) (size_t) &(((type *) 0)->identifier) 
  36. #endif
  37.  
  38. /* Read in all the section data and relocation stuff too */
  39. PROTO(static boolean,oasys_slurp_section_data,(bfd *CONST abfd));
  40.  
  41. static void 
  42. DEFUN(oasys_read_record,(abfd, record),
  43.       bfd *CONST abfd AND 
  44.       oasys_record_union_type *record)
  45. {
  46.  
  47.   bfd_read((PTR)record, 1, sizeof(record->header), abfd);
  48.  
  49.   if ((size_t) record->header.length <= (size_t) sizeof (record->header))
  50.     return;
  51.   bfd_read((PTR)(((char *)record )+ sizeof(record->header)),
  52.        1, record->header.length - sizeof(record->header),
  53.        abfd);
  54. }
  55. static size_t
  56. DEFUN(oasys_string_length,(record),
  57.       oasys_record_union_type *record)
  58. {
  59. return  record->header.length
  60.     - ((char *)record->symbol.name - (char *)record);
  61. }
  62.  
  63. /*****************************************************************************/
  64.  
  65. /*
  66.  
  67. Slurp the symbol table by reading in all the records at the start file
  68. till we get to the first section record.
  69.  
  70. We'll sort the symbolss into  two lists, defined and undefined. The
  71. undefined symbols will be placed into the table according to their
  72. refno. 
  73.  
  74. We do this by placing all undefined symbols at the front of the table
  75. moving in, and the defined symbols at the end of the table moving back.
  76.  
  77. */
  78.  
  79. static boolean
  80. DEFUN(oasys_slurp_symbol_table,(abfd),
  81.     bfd * CONST abfd)
  82. {
  83.   oasys_record_union_type record;
  84.   oasys_data_type *data = oasys_data(abfd);
  85.   boolean loop = true;
  86.   asymbol *dest_defined;
  87.   asymbol *dest;
  88.   char *string_ptr;
  89.  
  90.  
  91.   if (data->symbols != (asymbol *)NULL) {
  92.     return true;
  93.   }
  94.   /* Buy enough memory for all the symbols and all the names */
  95.   data->symbols = 
  96.     (asymbol *)bfd_alloc(abfd, sizeof(asymbol) * abfd->symcount);
  97. #ifdef UNDERSCORE_HACK
  98.   /* buy 1 more char for each symbol to keep the underscore in*/
  99.   data->strings = bfd_alloc(abfd, data->symbol_string_length +
  100.                 abfd->symcount);
  101. #else
  102.   data->strings = bfd_alloc(abfd, data->symbol_string_length);
  103. #endif
  104.  
  105.  
  106.   dest_defined = data->symbols + abfd->symcount -1;
  107.  
  108.   string_ptr = data->strings;
  109.   bfd_seek(abfd, (file_ptr)0, SEEK_SET);
  110.   while (loop) {
  111.  
  112.     oasys_read_record(abfd, &record);
  113.     switch (record.header.type) {
  114.     case oasys_record_is_header_enum:
  115.       break;
  116.     case oasys_record_is_local_enum:
  117.     case oasys_record_is_symbol_enum:
  118.     {
  119.       int       flag = record.header.type == (int)oasys_record_is_local_enum ?
  120.         (BSF_LOCAL) : (BSF_GLOBAL | BSF_EXPORT);
  121.  
  122.  
  123.       size_t length = oasys_string_length(&record);
  124.       switch (record.symbol.relb & RELOCATION_TYPE_BITS) {
  125.       case RELOCATION_TYPE_ABS:
  126.         dest = dest_defined--;
  127.         dest->section = 0;
  128.         dest->flags = BSF_ABSOLUTE | flag;
  129.         break;
  130.       case RELOCATION_TYPE_REL:
  131.         dest = dest_defined--;
  132.         dest->section =
  133.           oasys_data(abfd)->sections[record.symbol.relb &
  134.                      RELOCATION_SECT_BITS];
  135.         if (record.header.type == (int)oasys_record_is_local_enum) 
  136.         {
  137.           dest->flags = BSF_LOCAL;
  138.           if (dest->section ==(asection *)(~0)) {
  139.             /* It seems that sometimes internal symbols are tied up, but
  140.                still get output, even though there is no
  141.                section */
  142.             dest->section = 0;
  143.           }
  144.         }
  145.         else {
  146.  
  147.           dest->flags = flag;
  148.         }
  149.         break;
  150.       case RELOCATION_TYPE_UND:
  151.         dest = data->symbols + bfd_h_get_16(abfd, (bfd_byte *)&record.symbol.refno[0]);
  152.         dest->section = (asection *)NULL;
  153.         dest->flags = BSF_UNDEFINED;
  154.         break;
  155.       case RELOCATION_TYPE_COM:
  156.         dest = dest_defined--;
  157.         dest->name = string_ptr;
  158.         dest->the_bfd = abfd;
  159.  
  160.         dest->section = (asection *)NULL;
  161.         dest->flags = BSF_FORT_COMM;
  162.         break;
  163.       default:
  164.         dest = dest_defined--;
  165.         BFD_ASSERT(0);
  166.         break;
  167.       }
  168.       dest->name = string_ptr;
  169.       dest->the_bfd = abfd;
  170.       dest->udata = (PTR)NULL;
  171.       dest->value = bfd_h_get_32(abfd, (bfd_byte *)&record.symbol.value[0]);
  172.  
  173. #ifdef UNDERSCORE_HACK
  174.       if (record.symbol.name[0] != '_') {
  175.         string_ptr[0] = '_';
  176.         string_ptr++;
  177.       }
  178. #endif
  179.       memcpy(string_ptr, record.symbol.name, length);
  180.  
  181.  
  182.       string_ptr[length] =0;
  183.       string_ptr += length +1;
  184.     }
  185.       break;
  186.     default:
  187.       loop = false;
  188.     }
  189.   }
  190.   return true;
  191. }
  192.  
  193. static unsigned int
  194. DEFUN(oasys_get_symtab_upper_bound,(abfd),
  195.      bfd *CONST abfd)
  196. {
  197.   oasys_slurp_symbol_table (abfd);
  198.  
  199.   return    (abfd->symcount+1) * (sizeof (oasys_symbol_type *));
  200. }
  201.  
  202. /* 
  203. */
  204.  
  205. extern bfd_target oasys_vec;
  206.  
  207. unsigned int
  208. DEFUN(oasys_get_symtab,(abfd, location),
  209.       bfd *abfd AND
  210.       asymbol **location)
  211. {
  212.   asymbol *symbase ;
  213.   unsigned int counter ;
  214.   if (oasys_slurp_symbol_table(abfd) == false) {
  215.     return 0;
  216.   }
  217.   symbase = oasys_data(abfd)->symbols;
  218.   for (counter = 0; counter < abfd->symcount; counter++) {
  219.     *(location++) = symbase++;
  220.   }
  221.   *location = 0;
  222.   return abfd->symcount;
  223. }
  224.  
  225. /***********************************************************************
  226. *  archive stuff 
  227. */
  228.  
  229. static bfd_target *
  230. DEFUN(oasys_archive_p,(abfd),
  231.       bfd *abfd)
  232. {
  233.   oasys_archive_header_type header;
  234.   oasys_extarchive_header_type header_ext;
  235.   unsigned int i;
  236.   file_ptr filepos;  
  237.   bfd_seek(abfd, (file_ptr) 0, false);
  238.  
  239.   
  240.   bfd_read((PTR)&header_ext, 1, sizeof(header_ext), abfd);
  241.  
  242.  
  243.   header.version = bfd_h_get_32(abfd, (bfd_byte *)header_ext.version);
  244.   header.mod_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.mod_count);
  245.   header.mod_tbl_offset = bfd_h_get_32(abfd, (bfd_byte *)header_ext.mod_tbl_offset);
  246.   header.sym_tbl_size = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_tbl_size);
  247.   header.sym_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_count);
  248.   header.sym_tbl_offset = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_tbl_offset);
  249.   header.xref_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.xref_count);
  250.   header.xref_lst_offset = bfd_h_get_32(abfd, (bfd_byte *)header_ext.xref_lst_offset);
  251.  
  252.   /*
  253.     There isn't a magic number in an Oasys archive, so the best we
  254.     can do to verify reasnableness is to make sure that the values in
  255.     the header are too weird
  256.     */
  257.  
  258.   if (header.version>10000 ||
  259.       header.mod_count>10000 ||
  260.       header.sym_count>100000 ||
  261.       header.xref_count > 100000) return (bfd_target *)NULL;
  262.  
  263.   /*
  264.     That all worked, lets buy the space for the header and read in
  265.     the headers.
  266.     */
  267.     {
  268.       oasys_ar_data_type *ar =
  269.     (oasys_ar_data_type*) bfd_alloc(abfd, sizeof(oasys_ar_data_type));
  270.  
  271.  
  272.       oasys_module_info_type *module = 
  273.     (oasys_module_info_type*)
  274.       bfd_alloc(abfd, sizeof(oasys_module_info_type) * header.mod_count);
  275.  
  276.  
  277.       oasys_module_table_type record;
  278.  
  279.  
  280.       set_tdata(abfd, ar);
  281.       ar->module = module;
  282.       ar->module_count = header.mod_count;
  283.  
  284.  
  285.       filepos = header.mod_tbl_offset;
  286.       for (i = 0; i < header.mod_count; i++) {
  287.         bfd_seek(abfd , filepos, SEEK_SET);
  288.  
  289.     /* There are two ways of specifying the archive header */
  290.  
  291.     if (0) {
  292.       oasys_extmodule_table_type_a_type record_ext;
  293.       bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
  294.     
  295.       record.mod_size = bfd_h_get_32(abfd, (bfd_byte *)record_ext.mod_size);
  296.       record.file_offset = bfd_h_get_32(abfd,
  297.                      (bfd_byte *)   record_ext.file_offset);
  298.  
  299.       record.dep_count = bfd_h_get_32(abfd, (bfd_byte *)record_ext.dep_count);
  300.       record.depee_count = bfd_h_get_32(abfd,(bfd_byte *) record_ext.depee_count);
  301.       record.sect_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.sect_count);
  302.  
  303.  
  304.       module[i].name = bfd_alloc(abfd,33);
  305.  
  306.       memcpy(module[i].name, record_ext.mod_name, 33);
  307.       filepos +=
  308.         sizeof(record_ext) + 
  309.           record.dep_count * 4 +
  310.         record.depee_count * 4 +
  311.           record.sect_count * 8 + 187;
  312.     }
  313.     else {
  314.       oasys_extmodule_table_type_b_type record_ext;
  315.       bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
  316.     
  317.       record.mod_size = bfd_h_get_32(abfd, (bfd_byte *) record_ext.mod_size);
  318.       record.file_offset = bfd_h_get_32(abfd,
  319.                         (bfd_byte *)record_ext.file_offset);
  320.  
  321.       record.dep_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.dep_count);
  322.       record.depee_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.depee_count);
  323.       record.sect_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.sect_count);
  324.       record.module_name_size = bfd_h_get_32(abfd, (bfd_byte *) record_ext.mod_name_length);
  325.  
  326.       module[i].name = bfd_alloc(abfd,record.module_name_size + 1);
  327.       bfd_read((PTR)module[i].name, 1, record.module_name_size, abfd);
  328.       module[i].name[record.module_name_size] = 0;
  329.       filepos +=
  330.         sizeof(record_ext) + 
  331.           record.dep_count * 4 +
  332.         record.module_name_size + 1;
  333.  
  334.     }
  335.  
  336.  
  337.     module[i].size = record.mod_size;
  338.     module[i].pos = record.file_offset;
  339.     module[i].abfd = 0;
  340.       }
  341.       
  342.     }
  343.   return abfd->xvec;
  344. }
  345.  
  346. static boolean
  347. DEFUN(oasys_mkobject,(abfd),
  348.       bfd *abfd)
  349. {
  350.  
  351.   set_tdata (abfd,
  352.     (oasys_data_type*)bfd_alloc(abfd, sizeof(oasys_data_type)));
  353.   return true;
  354. }
  355.  
  356. #define MAX_SECS 16
  357. static bfd_target *
  358. DEFUN(oasys_object_p,(abfd),
  359.       bfd *abfd)
  360. {
  361.   oasys_data_type *oasys;
  362.   oasys_data_type *save = oasys_data(abfd);
  363.   boolean loop = true;
  364.   boolean had_usefull = false;
  365.  
  366.   set_tdata (abfd, 0);
  367.   oasys_mkobject(abfd);
  368.   oasys = oasys_data(abfd);
  369.   memset((PTR)oasys->sections, 0xff, sizeof(oasys->sections));
  370.     
  371.   /* Point to the start of the file */
  372.   bfd_seek(abfd, (file_ptr)0, SEEK_SET);
  373.   oasys->symbol_string_length = 0;
  374.   /* Inspect the records, but only keep the section info -
  375.      remember the size of the symbols
  376.      */
  377.   oasys->first_data_record = 0;
  378.   while (loop) {
  379.     oasys_record_union_type record;
  380.     oasys_read_record(abfd, &record);
  381.     if ((size_t)record.header.length < (size_t)sizeof(record.header))
  382.       goto fail;
  383.  
  384.  
  385.     switch ((oasys_record_enum_type)(record.header.type)) {
  386.     case oasys_record_is_header_enum:
  387.       had_usefull = true;
  388.       break;
  389.     case oasys_record_is_symbol_enum:
  390.     case oasys_record_is_local_enum:
  391.       /* Count symbols and remember their size for a future malloc   */
  392.       abfd->symcount++;
  393.       oasys->symbol_string_length += 1 + oasys_string_length(&record);
  394.       had_usefull = true;
  395.       break;
  396.     case oasys_record_is_section_enum:
  397.     {
  398.       asection *s;
  399.       char *buffer;
  400.       unsigned int section_number;
  401.       if (record.section.header.length != sizeof(record.section))
  402.           {
  403.         goto fail;
  404.           }
  405.       buffer = bfd_alloc(abfd, 3);
  406.       section_number= record.section.relb & RELOCATION_SECT_BITS;
  407.       sprintf(buffer,"%u", section_number);
  408.       s = bfd_make_section(abfd,buffer);
  409.       oasys->sections[section_number] = s;
  410.       switch (record.section.relb & RELOCATION_TYPE_BITS) {
  411.       case RELOCATION_TYPE_ABS:
  412.       case RELOCATION_TYPE_REL:
  413.         break;
  414.       case RELOCATION_TYPE_UND:
  415.       case RELOCATION_TYPE_COM:
  416.         BFD_FAIL();
  417.       }
  418.  
  419.       s->size  = bfd_h_get_32(abfd, (bfd_byte *) & record.section.value[0]) ;
  420.       s->vma = bfd_h_get_32(abfd, (bfd_byte *)&record.section.vma[0]);
  421.       s->flags= 0;
  422.       had_usefull = true;
  423.     }
  424.       break;
  425.     case oasys_record_is_data_enum:
  426.       oasys->first_data_record = bfd_tell(abfd) - record.header.length;
  427.     case oasys_record_is_debug_enum:
  428.     case oasys_record_is_module_enum:
  429.     case oasys_record_is_named_section_enum:
  430.     case oasys_record_is_end_enum:
  431.       if (had_usefull == false) goto fail;
  432.       loop = false;
  433.       break;
  434.     default:
  435.       goto fail;
  436.     }
  437.   }
  438.   oasys->symbols = (asymbol *)NULL;
  439.   /* 
  440.     Oasys support several architectures, but I can't see a simple way
  441.     to discover which one is in a particular file - we'll guess 
  442.     */
  443.   bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0);
  444.   if (abfd->symcount != 0) {
  445.     abfd->flags |= HAS_SYMS;
  446.   }
  447.  
  448.   /* 
  449.     We don't know if a section has data until we've read it..
  450.     */
  451.  
  452.   oasys_slurp_section_data(abfd);
  453.  
  454.  
  455.   return abfd->xvec;
  456.  
  457.  fail:
  458.   (void)  bfd_release(abfd, oasys);
  459.   set_tdata (abfd, save);
  460.   return (bfd_target *)NULL;
  461. }
  462.  
  463.  
  464. static void 
  465. DEFUN(oasys_print_symbol,(ignore_abfd, afile, symbol, how),
  466.       bfd *ignore_abfd AND
  467.       PTR afile AND
  468.       asymbol *symbol AND
  469.       bfd_print_symbol_type how)
  470. {
  471.   FILE *file = (FILE *)afile;
  472.  
  473.   switch (how) {
  474.   case bfd_print_symbol_name:
  475.   case bfd_print_symbol_more:
  476.     fprintf(file,"%s", symbol->name);
  477.     break;
  478.   case bfd_print_symbol_all:
  479.     {
  480. CONST      char *section_name = symbol->section == (asection *)NULL ?
  481.     "*abs" : symbol->section->name;
  482.  
  483.       bfd_print_symbol_vandf((PTR)file,symbol);
  484.  
  485.       fprintf(file," %-5s %s",
  486.           section_name,
  487.           symbol->name);
  488.     }
  489.     break;
  490.   }
  491. }
  492. /*
  493.  The howto table is build using the top two bits of a reloc byte to
  494.  index into it. The bits are PCREL,WORD/LONG
  495. */
  496. static reloc_howto_type howto_table[]= 
  497. {
  498.  
  499. HOWTO(  0, 0,  1,   16, false,0,   true,true,0,"abs16",true,0x0000ffff, 0x0000ffff,false),
  500. HOWTO(  0, 0,  2,   32, false,0,   true,true,0,"abs32",true,0xffffffff, 0xffffffff,false),
  501. HOWTO(  0, 0,  1,   16, true,0,   true,true,0,"pcrel16",true,0x0000ffff, 0x0000ffff,false),
  502. HOWTO(  0, 0,  2,   32, true,0,   true,true,0,"pcrel32",true,0xffffffff, 0xffffffff,false)
  503. };
  504.  
  505. /* Read in all the section data and relocation stuff too */
  506. static boolean 
  507. DEFUN(oasys_slurp_section_data,(abfd),
  508.   bfd *CONST abfd)
  509. {
  510.   oasys_record_union_type record;
  511.   oasys_data_type *data = oasys_data(abfd);
  512.   boolean loop = true;
  513.  
  514.   oasys_per_section_type *per ;
  515.  
  516.   asection *s;
  517.  
  518.   /* See if the data has been slurped already .. */
  519.   for (s = abfd->sections; s != (asection *)NULL; s= s->next) {
  520.     per =  oasys_per_section(s);
  521.     if (per->initialized == true) 
  522.       return true;
  523.   }
  524.  
  525.   if (data->first_data_record == 0)  return true;
  526.  
  527.   bfd_seek(abfd, data->first_data_record, SEEK_SET);
  528.   while (loop) {
  529.     oasys_read_record(abfd, &record);
  530.     switch (record.header.type) 
  531.     {
  532.     case oasys_record_is_header_enum:
  533.       break;
  534.     case oasys_record_is_data_enum:
  535.         {
  536.  
  537.           uint8e_type *src = record.data.data;
  538.           uint8e_type *end_src = ((uint8e_type *)&record) +
  539.         record.header.length;
  540.           unsigned int relbit;
  541.           bfd_byte *dst_ptr ;
  542.           bfd_byte *dst_base_ptr ;
  543.           unsigned int count;
  544.           asection *  section =
  545.         data->sections[record.data.relb & RELOCATION_SECT_BITS];
  546.           bfd_vma dst_offset ;
  547.           per =  oasys_per_section(section);
  548.  
  549.  
  550.           if (per->initialized == false) 
  551.           {
  552.             per->data = (bfd_byte *) bfd_zalloc(abfd, section->size);
  553.             per->reloc_tail_ptr = (oasys_reloc_type **)&(section->relocation);
  554.             per->had_vma = false;
  555.             per->initialized = true;
  556.             section->reloc_count = 0;
  557.             section->flags = SEC_ALLOC;
  558.           }
  559.  
  560.           dst_offset = bfd_h_get_32(abfd, record.data.addr) ;
  561.           if (per->had_vma == false) {
  562.         /* Take the first vma we see as the base */
  563.  
  564.         section->vma = dst_offset;
  565.         per->had_vma = true;
  566.           }
  567.  
  568.  
  569.           dst_offset -=   section->vma;
  570.  
  571.  
  572.           dst_base_ptr = oasys_per_section(section)->data;
  573.           dst_ptr = oasys_per_section(section)->data +
  574.         dst_offset;
  575.  
  576.           if (src < end_src) {
  577.         section->flags |= SEC_LOAD | SEC_HAS_CONTENTS;
  578.           }
  579.           while (src < end_src) {
  580.         uint8e_type mod_byte = *src++;
  581.         uint32_type gap = end_src - src;
  582.         
  583.         count = 8;
  584.         if (mod_byte == 0 && gap >= 8) {
  585.           dst_ptr[0] = src[0];
  586.           dst_ptr[1] = src[1];
  587.           dst_ptr[2] = src[2];
  588.           dst_ptr[3] = src[3];
  589.           dst_ptr[4] = src[4];
  590.           dst_ptr[5] = src[5];
  591.           dst_ptr[6] = src[6];
  592.           dst_ptr[7] = src[7];
  593.           dst_ptr+= 8;
  594.           src += 8;
  595.         }
  596.         else {
  597.           for (relbit = 1; count-- != 0 && src < end_src; relbit <<=1) 
  598.               {
  599.             if (relbit & mod_byte) 
  600.                 {
  601.                   uint8e_type reloc = *src;
  602.                   /* This item needs to be relocated */
  603.                   switch (reloc & RELOCATION_TYPE_BITS) {
  604.                   case RELOCATION_TYPE_ABS:
  605.  
  606.                 break;
  607.  
  608.                   case RELOCATION_TYPE_REL: 
  609.                   {
  610.                     /* Relocate the item relative to the section */
  611.                     oasys_reloc_type *r =
  612.                       (oasys_reloc_type *)
  613.                     bfd_alloc(abfd,
  614.                           sizeof(oasys_reloc_type));
  615.                     *(per->reloc_tail_ptr) = r;
  616.                     per->reloc_tail_ptr = &r->next;
  617.                     r->next= (oasys_reloc_type *)NULL;
  618.                     /* Reference to undefined symbol */
  619.                     src++;
  620.                     /* There is no symbol */
  621.                     r->symbol = 0;
  622.                     /* Work out the howto */
  623.                     r->relent.section =
  624.                       data->sections[reloc & RELOCATION_SECT_BITS];
  625.                     r->relent.addend = - r->relent.section->vma;
  626.                     r->relent.address = dst_ptr - dst_base_ptr;
  627.                     r->relent.howto = &howto_table[reloc>>6];
  628.                     r->relent.sym_ptr_ptr = (asymbol **)NULL;
  629.                     section->reloc_count++;
  630.  
  631.                     /* Fake up the data to look like it's got the -ve pc in it, this makes
  632.                        it much easier to convert into other formats. This is done by
  633.                        hitting the addend.
  634.                        */
  635.                     if (r->relent.howto->pc_relative == true) {
  636.                       r->relent.addend -= dst_ptr - dst_base_ptr;
  637.                     }
  638.  
  639.  
  640.                   }
  641.                 break;
  642.  
  643.  
  644.                   case RELOCATION_TYPE_UND:
  645.                   { 
  646.                     oasys_reloc_type *r =
  647.                       (oasys_reloc_type *)
  648.                     bfd_alloc(abfd,
  649.                           sizeof(oasys_reloc_type));
  650.                     *(per->reloc_tail_ptr) = r;
  651.                     per->reloc_tail_ptr = &r->next;
  652.                     r->next= (oasys_reloc_type *)NULL;
  653.                     /* Reference to undefined symbol */
  654.                     src++;
  655.                     /* Get symbol number */
  656.                     r->symbol = (src[0]<<8) | src[1];
  657.                     /* Work out the howto */
  658.                     r->relent.section = (asection *)NULL;
  659.                     r->relent.addend = 0;
  660.                     r->relent.address = dst_ptr - dst_base_ptr;
  661.                     r->relent.howto = &howto_table[reloc>>6];
  662.                     r->relent.sym_ptr_ptr = (asymbol **)NULL;
  663.                     section->reloc_count++;
  664.  
  665.                     src+=2;
  666.                     /* Fake up the data to look like it's got the -ve pc in it, this makes
  667.                        it much easier to convert into other formats. This is done by
  668.                        hitting the addend.
  669.                        */
  670.                     if (r->relent.howto->pc_relative == true) {
  671.                       r->relent.addend -= dst_ptr - dst_base_ptr;
  672.                     }
  673.  
  674.                 
  675.  
  676.                   }
  677.                 break;
  678.                   case RELOCATION_TYPE_COM:
  679.                 BFD_FAIL();
  680.                   }
  681.                 }
  682.             *dst_ptr++ = *src++;
  683.               }
  684.         }
  685.           }      
  686.         }
  687.       break;
  688.     case oasys_record_is_local_enum:
  689.     case oasys_record_is_symbol_enum:
  690.     case oasys_record_is_section_enum:
  691.       break;
  692.     default:
  693.       loop = false;
  694.     }
  695.   }
  696.  
  697.   return true;
  698.  
  699. }
  700.  
  701.  
  702.  
  703. bfd_error_vector_type bfd_error_vector;
  704.  
  705. static boolean
  706. DEFUN(oasys_new_section_hook,(abfd, newsect),
  707.       bfd *abfd AND
  708.       asection *newsect)
  709. {
  710.   newsect->used_by_bfd = (PTR)
  711.     bfd_alloc(abfd, sizeof(oasys_per_section_type));
  712.   oasys_per_section( newsect)->data = (bfd_byte *)NULL;
  713.   oasys_per_section(newsect)->section = newsect;
  714.   oasys_per_section(newsect)->offset  = 0;
  715.   oasys_per_section(newsect)->initialized = false;
  716.   newsect->alignment_power = 1;
  717.   /* Turn the section string into an index */
  718.  
  719.   sscanf(newsect->name,"%u", &newsect->target_index);
  720.  
  721.   return true;
  722. }
  723.  
  724.  
  725. static unsigned int
  726. DEFUN(oasys_get_reloc_upper_bound, (abfd, asect),
  727.       bfd *abfd AND
  728.       sec_ptr asect)
  729. {
  730.   oasys_slurp_section_data(abfd);
  731.   return (asect->reloc_count+1) * sizeof(arelent *);
  732. }
  733.  
  734. static boolean
  735. DEFUN(oasys_get_section_contents,(abfd, section, location, offset, count),
  736.       bfd *abfd AND
  737.       sec_ptr section AND
  738.       PTR location AND
  739.       file_ptr offset AND
  740.       bfd_size_type count)
  741. {
  742.   oasys_per_section_type *p = (oasys_per_section_type *) section->used_by_bfd;
  743.   oasys_slurp_section_data(abfd);
  744.   if (p->initialized == false) 
  745.       {
  746.     (void) memset(location, 0, (int)count);
  747.       }
  748.   else 
  749.       {
  750.     (void) memcpy(location,(PTR)( p->data + offset), (int)count);
  751.       }
  752.   return true;
  753. }
  754.  
  755.  
  756. unsigned int
  757. DEFUN(oasys_canonicalize_reloc,(ignore_abfd, section, relptr, symbols),
  758.       bfd *ignore_abfd AND
  759.       sec_ptr section AND
  760.       arelent **relptr AND
  761.       asymbol **symbols)
  762. {
  763.   unsigned int reloc_count = 0;
  764.   oasys_reloc_type *src = (oasys_reloc_type *)(section->relocation);
  765.   while (src != (oasys_reloc_type *)NULL) {
  766.     if (src->relent.section == (asection *)NULL) 
  767.     {
  768.       src->relent.sym_ptr_ptr = symbols + src->symbol;
  769.     }
  770.     *relptr ++ = &src->relent;
  771.     src = src->next;
  772.     reloc_count++;
  773.   }
  774.   *relptr = (arelent *)NULL;
  775.   return section->reloc_count = reloc_count;
  776. }
  777.  
  778.  
  779.  
  780.  
  781. /* Writing */
  782.  
  783.  
  784. /* Calculate the checksum and write one record */
  785. static void 
  786. DEFUN(oasys_write_record,(abfd, type, record, size),
  787.       bfd *CONST abfd AND
  788.       CONST oasys_record_enum_type type AND
  789.       oasys_record_union_type *record AND
  790.       CONST size_t size)
  791. {
  792.   int checksum;
  793.   size_t i;
  794.   uint8e_type *ptr;
  795.   record->header.length = size;
  796.   record->header.type = (int)type;
  797.   record->header.check_sum = 0;
  798.   record->header.fill = 0;
  799.   ptr = &record->pad[0];
  800.   checksum = 0;
  801.   for (i = 0; i < size; i++) {
  802.     checksum += *ptr++;
  803.   }
  804.   record->header.check_sum = 0xff & (- checksum);
  805.   bfd_write((PTR)record, 1, size, abfd);
  806. }
  807.  
  808.  
  809. /* Write out all the symbols */
  810. static void 
  811. DEFUN(oasys_write_syms, (abfd),
  812.       bfd * CONST abfd)
  813. {
  814.   unsigned int count;
  815.   asymbol **generic = bfd_get_outsymbols(abfd);
  816.   unsigned int index = 0;
  817.   for (count = 0; count < bfd_get_symcount(abfd); count++) {
  818.  
  819.     oasys_symbol_record_type symbol;
  820.     asymbol * CONST g = generic[count];
  821.  
  822.     CONST    char *src = g->name;
  823.     char *dst = symbol.name;
  824.     unsigned int l = 0;
  825.  
  826.     if (g->flags & BSF_FORT_COMM) {
  827.       symbol.relb = RELOCATION_TYPE_COM;
  828.       bfd_h_put_16(abfd, index, (uint8e_type *)(&symbol.refno[0]));
  829.       index++;
  830.     }
  831.     else if (g->flags & BSF_ABSOLUTE) {
  832.       symbol.relb = RELOCATION_TYPE_ABS;
  833.       bfd_h_put_16(abfd, 0, (uint8e_type *)(&symbol.refno[0]));
  834.  
  835.     }
  836.     else if (g->flags & BSF_UNDEFINED) {
  837.       symbol.relb = RELOCATION_TYPE_UND ;
  838.       bfd_h_put_16(abfd, index, (uint8e_type *)(&symbol.refno[0]));
  839.       /* Overload the value field with the output index number */
  840.       index++;
  841.     }
  842.     else if (g->flags & BSF_DEBUGGING) {
  843.       /* throw it away */
  844.       continue;
  845.     }
  846.     else {
  847.       if (g->section == (asection *)NULL) {
  848.     /* Sometime, the oasys tools give out a symbol with illegal
  849.        bits in it, we'll output it in the same broken way */
  850.     
  851.     symbol.relb = RELOCATION_TYPE_REL | 0;
  852.       }
  853.       else {
  854.     symbol.relb = RELOCATION_TYPE_REL |g->section->output_section->target_index;
  855.       }
  856.       bfd_h_put_16(abfd, 0, (uint8e_type *)(&symbol.refno[0]));
  857.     }
  858.     while (src[l]) {
  859.       dst[l] = src[l];
  860.       l++;
  861.     }
  862.  
  863.     bfd_h_put_32(abfd, g->value, (bfd_byte*) symbol.value);
  864.  
  865.       
  866.     if (g->flags & BSF_LOCAL) {
  867.       oasys_write_record(abfd,     
  868.              oasys_record_is_local_enum,
  869.              (oasys_record_union_type *) &symbol,
  870.              offsetof(oasys_symbol_record_type, name[0]) + l);
  871.     }
  872.     else {
  873.       oasys_write_record(abfd,     
  874.              oasys_record_is_symbol_enum,
  875.              (oasys_record_union_type *) &symbol,
  876.              offsetof(oasys_symbol_record_type, name[0]) + l);
  877.     }
  878.     g->value = index-1;
  879.   }
  880. }
  881.  
  882.  
  883.   /* Write a section header for each section */
  884. static void 
  885. DEFUN(oasys_write_sections, (abfd),
  886.       bfd *CONST abfd)
  887. {
  888.   asection *s;
  889.   static  oasys_section_record_type out = {0};
  890.  
  891.   for (s = abfd->sections; s != (asection *)NULL; s = s->next) {
  892.     if (!isdigit(s->name[0])) 
  893.     {
  894.           bfd_error_vector.nonrepresentable_section(abfd,
  895.                             s->name);
  896.     }
  897.     out.relb = RELOCATION_TYPE_REL | s->target_index;
  898.     bfd_h_put_32(abfd, s->size, (bfd_byte *) out.value);
  899.     bfd_h_put_32(abfd, s->vma, (bfd_byte *) out.vma);
  900.  
  901.     oasys_write_record(abfd,
  902.                oasys_record_is_section_enum,
  903.                (oasys_record_union_type *) &out,
  904.                sizeof(out));
  905.   }
  906. }
  907.  
  908. static void
  909. DEFUN(oasys_write_header, (abfd),
  910.       bfd *CONST abfd)
  911. {
  912.   /* Create and write the header */
  913.   oasys_header_record_type r;
  914.   size_t length = strlen(abfd->filename);
  915.   if (length > (size_t)sizeof(r.module_name)) {
  916.     length = sizeof(r.module_name);
  917.   }
  918.  
  919.   (void)memcpy(r.module_name,
  920.            abfd->filename,
  921.            length);
  922.   (void)memset(r.module_name + length,
  923.            ' ',
  924.            sizeof(r.module_name) - length);
  925.  
  926.   r.version_number = OASYS_VERSION_NUMBER;
  927.   r.rev_number = OASYS_REV_NUMBER;
  928.   oasys_write_record(abfd,
  929.              oasys_record_is_header_enum,
  930.              (oasys_record_union_type *)&r,
  931.              offsetof(oasys_header_record_type, description[0]));
  932.  
  933.  
  934.  
  935. }
  936.  
  937. static void
  938. DEFUN(oasys_write_end,(abfd),
  939.       bfd *CONST abfd)
  940. {
  941.   oasys_end_record_type end;
  942.   uint8e_type null = 0;
  943.   end.relb = RELOCATION_TYPE_ABS;
  944.   bfd_h_put_32(abfd, abfd->start_address, (bfd_byte *)end.entry); 
  945.   bfd_h_put_16(abfd, 0, (bfd_byte *)end.fill);
  946.   end.zero =0;
  947.   oasys_write_record(abfd,
  948.              oasys_record_is_end_enum,
  949.              (oasys_record_union_type *)&end,
  950.              sizeof(end));
  951.   bfd_write((PTR)&null, 1, 1, abfd);
  952. }
  953.  
  954. static int 
  955. DEFUN(comp,(ap, bp),
  956.    CONST PTR ap AND
  957.    CONST PTR bp)
  958. {
  959.   arelent *a = *((arelent **)ap);
  960.   arelent *b = *((arelent **)bp);
  961.   return a->address - b->address;
  962. }
  963.  
  964. /*
  965.  Writing data..
  966.  
  967. */
  968. static void
  969. DEFUN(oasys_write_data, (abfd),
  970.       bfd *CONST abfd)
  971. {
  972.   asection *s;
  973.   for (s = abfd->sections; s != (asection *)NULL; s = s->next) {
  974.     if (s->flags & SEC_LOAD) {
  975.       uint8e_type *raw_data = oasys_per_section(s)->data;
  976.       oasys_data_record_type processed_data;
  977.       bfd_size_type current_byte_index = 0;
  978.       unsigned int relocs_to_go = s->reloc_count;
  979.       arelent **p = s->orelocation;
  980.       if (s->reloc_count != 0) {
  981.     /* Sort the reloc records so it's easy to insert the relocs into the
  982.        data */
  983.     
  984.     qsort(s->orelocation,
  985.           s->reloc_count,
  986.           sizeof(arelent **),
  987.           comp);
  988.       }
  989.       current_byte_index = 0;
  990.       processed_data.relb = s->target_index | RELOCATION_TYPE_REL;
  991.  
  992.       while (current_byte_index < s->size) 
  993.       {
  994.         /* Scan forwards by eight bytes or however much is left and see if
  995.            there are any relocations going on */
  996.         uint8e_type *mod = &processed_data.data[0];
  997.         uint8e_type *dst = &processed_data.data[1];
  998.  
  999.         unsigned int i;
  1000.         unsigned int long_length = 128;
  1001.  
  1002.  
  1003.         bfd_h_put_32(abfd, s->vma + current_byte_index, processed_data.addr);
  1004.         if ((size_t)(long_length + current_byte_index) > (size_t)(s->size)) {
  1005.           long_length = s->size - current_byte_index;
  1006.         }
  1007.         while (long_length  > 0 &&  (dst - (uint8e_type*)&processed_data < 128)) {
  1008.         
  1009.           unsigned int length = long_length;
  1010.           *mod =0;
  1011.           if (length > 8)
  1012.         length = 8;
  1013.  
  1014.           for (i = 0; i < length; i++) {
  1015.         if (relocs_to_go != 0) {    
  1016.           arelent *r = *p;
  1017.           reloc_howto_type *CONST how=r->howto;
  1018.           /* There is a relocation, is it for this byte ? */
  1019.           if (r->address == current_byte_index) {
  1020.             uint8e_type rel_byte;
  1021.             p++;
  1022.             relocs_to_go--;
  1023.  
  1024.             *mod |= (1<<i);
  1025.             if(how->pc_relative) {
  1026.               rel_byte = 0x80;
  1027.  
  1028.               /* Also patch the raw data so that it doesn't have
  1029.              the -ve stuff any more */
  1030.               if (how->size != 2) {
  1031.             bfd_put_16(abfd, 
  1032.                    bfd_get_16(abfd,raw_data) +
  1033.                    current_byte_index, raw_data);
  1034.               }
  1035.  
  1036.               else {
  1037.             bfd_put_32(abfd, 
  1038.                    bfd_get_32(abfd,raw_data) +
  1039.                    current_byte_index, raw_data);
  1040.               }
  1041.             }
  1042.             else {
  1043.               rel_byte = 0;
  1044.             }
  1045.             if (how->size ==2) {
  1046.               rel_byte |= 0x40;
  1047.             }
  1048.           
  1049.             /* Is this a section relative relocation, or a symbol
  1050.                relative relocation ? */
  1051.             if (r->section != (asection*)NULL) 
  1052.             {
  1053.               /* The relent has a section attached, so it must be section
  1054.                  relative */
  1055.               rel_byte |= RELOCATION_TYPE_REL;
  1056.               rel_byte |= r->section->output_section->target_index;
  1057.               *dst++ = rel_byte;
  1058.             }
  1059.             else 
  1060.             {
  1061.               asymbol *p = *(r->sym_ptr_ptr);
  1062.  
  1063.               /* If this symbol has a section attached, then it
  1064.                  has already been resolved.  Change from a symbol
  1065.                  ref to a section ref */
  1066.               if(p->section != (asection *)NULL) {
  1067.                 rel_byte |= RELOCATION_TYPE_REL;
  1068.                 rel_byte |=
  1069.                   p->section->output_section->target_index;
  1070.                 *dst++ = rel_byte;
  1071.               }
  1072.               else {
  1073.                 rel_byte |= RELOCATION_TYPE_UND;
  1074.           
  1075.  
  1076.                 *dst++ = rel_byte;
  1077.                 /* Next two bytes are a symbol index - we can get
  1078.                    this from the symbol value which has been zapped
  1079.                    into the symbol index in the table when the
  1080.                    symbol table was written
  1081.                    */
  1082.                 *dst++ = p->value >> 8;
  1083.                 *dst++ = p->value;
  1084.               }
  1085.  
  1086.             }
  1087.           }
  1088.         }
  1089.         /* If this is coming from an unloadable section then copy
  1090.            zeros */
  1091.         if (raw_data == (uint8e_type *)NULL) {
  1092.           *dst++ = 0;
  1093.         }
  1094.         else {
  1095.           *dst++ = *raw_data++;
  1096.         }
  1097.         current_byte_index++;
  1098.           }
  1099.           mod = dst++;
  1100.           long_length -= length;
  1101.         }
  1102.  
  1103.         oasys_write_record(abfd,
  1104.                    oasys_record_is_data_enum,
  1105.                    (oasys_record_union_type *)&processed_data,
  1106.                    dst - (uint8e_type*)&processed_data);
  1107.              
  1108.       }
  1109.     }
  1110.   }
  1111. }
  1112. static boolean
  1113. DEFUN(oasys_write_object_contents, (abfd),
  1114.       bfd * CONST abfd)
  1115. {
  1116.   oasys_write_header(abfd);
  1117.   oasys_write_syms(abfd);
  1118.   oasys_write_sections(abfd);
  1119.   oasys_write_data(abfd);
  1120.   oasys_write_end(abfd);
  1121.   return true;
  1122. }
  1123.  
  1124.  
  1125.  
  1126.  
  1127. /** exec and core file sections */
  1128.  
  1129. /* set section contents is complicated with OASYS since the format is 
  1130. * not a byte image, but a record stream.
  1131. */
  1132. static boolean
  1133. DEFUN(oasys_set_section_contents,(abfd, section, location, offset, count),
  1134.       bfd *abfd AND
  1135.       sec_ptr section AND 
  1136.       PTR location AND
  1137.       file_ptr offset AND
  1138.       bfd_size_type count)
  1139. {
  1140.   if (count != 0) {
  1141.     if (oasys_per_section(section)->data == (bfd_byte *)NULL ) 
  1142.     {
  1143.       oasys_per_section(section)->data =
  1144.         (bfd_byte *)(bfd_alloc(abfd,section->size));    
  1145.     }
  1146.     (void) memcpy((PTR)(oasys_per_section(section)->data + offset),
  1147.           location,
  1148.           count);
  1149.   }
  1150.   return true;
  1151. }
  1152.  
  1153.  
  1154.  
  1155. /* Native-level interface to symbols. */
  1156.  
  1157. /* We read the symbols into a buffer, which is discarded when this
  1158. function exits.  We read the strings into a buffer large enough to
  1159. hold them all plus all the cached symbol entries. */
  1160.  
  1161. static asymbol *
  1162. DEFUN(oasys_make_empty_symbol,(abfd),
  1163.       bfd *abfd)
  1164. {
  1165.  
  1166.   oasys_symbol_type  *new =
  1167.     (oasys_symbol_type *)bfd_zalloc (abfd, sizeof (oasys_symbol_type));
  1168.   new->symbol.the_bfd = abfd;
  1169.   return &new->symbol;
  1170.  
  1171. }
  1172.  
  1173.  
  1174.  
  1175.  
  1176. /* User should have checked the file flags; perhaps we should return
  1177. BFD_NO_MORE_SYMBOLS if there are none? */
  1178.  
  1179. static bfd *
  1180. oasys_openr_next_archived_file(arch, prev)
  1181. bfd *arch;
  1182. bfd *prev;
  1183. {
  1184.   oasys_ar_data_type *ar = oasys_ar_data(arch);
  1185.   oasys_module_info_type *p;
  1186.   /* take the next one from the arch state, or reset */
  1187.   if (prev == (bfd *)NULL) {
  1188.     /* Reset the index - the first two entries are bogus*/
  1189.     ar->module_index = 0;
  1190.   }
  1191.  
  1192.   p = ar->module + ar->module_index;
  1193.   ar->module_index++;
  1194.  
  1195.   if (ar->module_index <= ar->module_count) {
  1196.     if (p->abfd == (bfd *)NULL) {
  1197.       p->abfd = _bfd_create_empty_archive_element_shell(arch);
  1198.       p->abfd->origin = p->pos;
  1199.       p->abfd->filename = p->name;
  1200.  
  1201.       /* Fixup a pointer to this element for the member */
  1202.       p->abfd->arelt_data = (PTR)p;
  1203.     }
  1204.     return p->abfd;
  1205.   }
  1206.   else {
  1207.     bfd_error = no_more_archived_files;
  1208.     return (bfd *)NULL;
  1209.   }
  1210. }
  1211.  
  1212. static boolean
  1213. oasys_find_nearest_line(abfd,
  1214.              section,
  1215.              symbols,
  1216.              offset,
  1217.              filename_ptr,
  1218.              functionname_ptr,
  1219.              line_ptr)
  1220. bfd *abfd;
  1221. asection *section;
  1222. asymbol **symbols;
  1223. bfd_vma offset;
  1224. char **filename_ptr;
  1225. char **functionname_ptr;
  1226. unsigned int *line_ptr;
  1227. {
  1228.   return false;
  1229.  
  1230. }
  1231.  
  1232. static int
  1233. DEFUN(oasys_generic_stat_arch_elt,(abfd, buf),
  1234.       bfd *abfd AND
  1235.       struct stat *buf)
  1236. {
  1237.   oasys_module_info_type *mod = (oasys_module_info_type *) abfd->arelt_data;
  1238.   if (mod == (oasys_module_info_type *)NULL) {
  1239.     bfd_error = invalid_operation;
  1240.     return -1;
  1241.   }
  1242.   else {
  1243.     buf->st_size = mod->size;
  1244.     buf->st_mode = 0666;
  1245.     return 0;
  1246.   }
  1247. }
  1248.  
  1249. static int 
  1250. DEFUN(oasys_sizeof_headers,(abfd, exec),
  1251.       bfd *abfd AND
  1252.       boolean exec)
  1253. {
  1254. return 0;
  1255. }
  1256. #define FOO PROTO
  1257. #define oasys_core_file_failing_command (char *(*)())(bfd_nullvoidptr)
  1258. #define oasys_core_file_failing_signal (int (*)())bfd_0
  1259. #define oasys_core_file_matches_executable_p  0 
  1260. #define oasys_slurp_armap bfd_true
  1261. #define oasys_slurp_extended_name_table bfd_true
  1262. #define oasys_truncate_arname (void (*)())bfd_nullvoidptr
  1263. #define oasys_write_armap 0
  1264. #define oasys_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
  1265. #define    oasys_close_and_cleanup        bfd_generic_close_and_cleanup
  1266. #define oasys_set_arch_mach bfd_default_set_arch_mach
  1267. #define oasys_bfd_debug_info_start bfd_void
  1268. #define oasys_bfd_debug_info_end bfd_void
  1269. #define oasys_bfd_debug_info_accumulate  (FOO(void, (*), (bfd *, asection *)))bfd_void
  1270.  
  1271.  
  1272. /*SUPPRESS 460 */
  1273. bfd_target oasys_vec =
  1274. {
  1275.   "oasys",            /* name */
  1276.   bfd_target_oasys_flavour,
  1277.   true,                /* target byte order */
  1278.   true,                /* target headers byte order */
  1279.   (HAS_RELOC | EXEC_P |        /* object flags */
  1280.    HAS_LINENO | HAS_DEBUG |
  1281.    HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
  1282.   (SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS
  1283.    |SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
  1284.   ' ',                /* ar_pad_char */
  1285.   16,                /* ar_max_namelen */
  1286.   1,                /* minimum alignment */
  1287.   _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
  1288.   _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
  1289.  
  1290.     {_bfd_dummy_target,
  1291.        oasys_object_p,        /* bfd_check_format */
  1292.        oasys_archive_p,
  1293.        _bfd_dummy_target,
  1294.      },
  1295.     {                /* bfd_set_format */
  1296.       bfd_false,
  1297.       oasys_mkobject, 
  1298.       _bfd_generic_mkarchive,
  1299.       bfd_false
  1300.       },
  1301.     {                /* bfd_write_contents */
  1302.       bfd_false,
  1303.       oasys_write_object_contents,
  1304.       _bfd_write_archive_contents,
  1305.       bfd_false,
  1306.     },
  1307.   JUMP_TABLE(oasys)
  1308. };
  1309.